﻿using System;
using System.Data;
using System.Data.SqlClient;

namespace gms.data {
	public class Character : IComparable {
#region Properties
		public int player_id { get; set; }
		public int campaign_id { get; set; }
		public int delegate_player_id { get; set; }
		public string unique_id { get; set; }
#endregion
#region Constructors

#endregion
#region Additional Loads

#endregion
#region CRUD

#endregion
#region Utilities
		public int CompareTo(object obj) {
			/*
			character comp = (character)obj;

			if (person.first_name != comp.person.first_name) {
				return person.first_name.CompareTo(comp.person.first_name);
			}
			else {
				return name.CompareTo(comp.name);
			}
			*/

			return 0;
		}
		private void fill(DataSet values) {
			if (!Database.dataset_is_empty(values)) {
				for (int i = 0; i < values.Tables[0].Columns.Count; i++) {
					switch (values.Tables[0].Columns[i].ColumnName) {
						case "player_id": player_id = (int)values.Tables[0].Rows[0]["player_id"]; break;
						case "campaign_id": campaign_id = (int)values.Tables[0].Rows[0]["campaign_id"]; break;
						case "delegate_player_id": delegate_player_id = (int)values.Tables[0].Rows[0]["delegate_player_id"]; break;
						case "unique_id": unique_id = (string)values.Tables[0].Rows[0]["unique_id"]; break;
					}
				}
			}
		}
#endregion
	}
}